<template>
	<view>
		<!-- <u-navbar title="付款码" placeholder autoBack>
			<view class="flexright xiaohui" slot="right" @click="jumpurl('/pages_index/scancode')">掃一掃</view>
		</u-navbar> -->
		<view class="flexcenter" style="margin-top: 300rpx;">
			<uqrcode ref="uqrcode" canvas-id="qrcode" v-bind:value="qrcodeurl_text" :options="{ margin: 10}" size="180">
			</uqrcode>
		</view>
		<view class="margin_top flexcenter" @click="finish">
			<u-count-down ref="countDown" :time="300 * 1000" format="mm:ss" autoStart millisecond
				@finish="finish"></u-count-down>
			<view class="flexleft margin_left1">
				<u-icon name="reload" color="#999" size="16"></u-icon>
				<view class="xiaohui main_size">刷新</view>
			</view>

		</view>
		<view class="mainpadding posibottom" @click="jumpurl('/pages_index/scancode')">
			<view class="submitbtn">掃一掃</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				qrcodeurl_text: "",
			}
		},
		onShow() {
			this.getcode()
		},
		methods: {
			finish() {
				this.getcode()
				this.$refs.countDown.reset();
				this.$refs.countDown.start();
			},
			getcode() {
				uni.showLoading({
					mask: true,
					title: "請稍後"
				})
				httpRequest.request('/api/user/getPayCode', 'GET', {}).then(res => {
					uni.hideLoading()
					this.qrcodeurl_text = res.data.paycode
				})
			}
		}
	}
</script>

<style>

</style>